package com.mr.model;

import java.sql.Timestamp;

import org.apache.commons.lang.StringUtils;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;

import com.mr.util.DesUtils;

public class BaseInfo extends BaseObject{
	private static final long serialVersionUID = 1L;
	private Long id;
	@NotEmpty(message="名称不能为空！")
	private String name;
	private String contact;
	private String tel;
	private String qq;
	@Email(message="邮件格式不正确！")
	private String email;
	private String address;
	private String status;
	private Timestamp addtime;
	private Member member;
	public String getEnId(){
		return DesUtils.encrypt(this.id+"");
	}
	public Member getMember() {
		return member;
	}
	public void setMember(Member member) {
		this.member = member;
	}
	public BaseInfo(){
		this.status = Status.Y;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return StringUtils.trim(name);
	}
	public void setName(String name) {
		this.name = name.trim();
	}
	public String getContact() {
		return contact;
	}
	public void setContact(String contact) {
		this.contact = contact;
	}
	public String getTel() {
		return tel;
	}
	public void setTel(String tel) {
		this.tel = tel;
	}
	public String getQq() {
		return qq;
	}
	public void setQq(String qq) {
		this.qq = qq;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public Timestamp getAddtime() {
		return addtime;
	}
	public void setAddtime(Timestamp addtime) {
		this.addtime = addtime;
	}
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (!(o instanceof BaseInfo))
			return false;

		final BaseInfo temp = (BaseInfo) o;

		return !(this.getId() != null ? !(this.getId().equals(temp.getId()))
				: (temp.getId() != null));

	}

	public int hashCode() {
		return (this.getId() != null ? this.getId().hashCode() : 0);
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
}